import type { CodeParams, CodeResult, loginByCodeData, loginData, loginResult, UserData } from '@/types/user'
import request from '@/utils/request'

// 账号密码登录
export const loginByPasswordAPI = (data: loginData) => {
  return request.post<null, loginResult>('/login/password', data)
}

// 获取验证码
export const getCodeAPI = (params:CodeParams) => {
  return request.get<null, CodeResult>('/code', { params })
}

//验证码登录
export const loginByCodeAPI = (data:loginByCodeData) => {
  return request.post<null, loginResult>('/login', data)
}

// 获取用户信息
export const getUserInfoAPI = () => {
  return request.get<null, UserData>('/patient/myUser')
}